const AnyProxy = require('anyproxy');
const SocksProxyAgent = require('socks-proxy-agent');
const proxy = 'socks5://127.0.0.1:1086';
const agent = new SocksProxyAgent(proxy);

const options = {
    port: 8001, // 必选，代理服务器端口

    rule: require('./rule'),
    webInterface: { //web版界面配置
        enable: true,// 是否启用web版界面，默认false
        webPort: 8002
    },
    agent,
    // throttle: 10000,
    forceProxyHttps: true,
    wsIntercept: false, // 不开启websocket代理
    silent: true, //是否屏蔽所有console输出,
};
const proxyServer = new AnyProxy.ProxyServer(options);

proxyServer.on('ready', () => { /* */
});
proxyServer.on('error', (e) => { /* */
});
proxyServer.start();

//when finished
// proxyServer.close();
// a = 'https://aweme.snssdk.com/aweme/v1/play/?video_id=v0300f770000bj17s0v298s5putmpc60&line=0&ratio=540p&media_type=4&vr_type=0&improve_bitrate=0&h265=1&version_code=4.3.1&pass-region=1&pass-route=1&js_sdk_version=1.8.0.0&app_name=aweme&vid=82D42ABF-F373-4956-B714-8E7282B1C787&app_version=4.3.1&device_id=34961895962&channel=App%20Store&mcc_mnc=46002&aid=1128&screen_width=1125&openudid=e61cf44f1385470411f38d5fc1644968ef9d956c&os_api=18&ac=WIFI&os_version=12.2&device_platform=iphone&build_number=43104&device_type=iPhone10%2C3&iid=62539050602&idfa=D7F9AA02-AE58-4155-8EFB-8B6BBA58D00B'
// b = 'https://aweme.snssdk.com/aweme/v1/play/?video_id=v0300f770000bj17s0v298s5putmpc60&line=0&ratio=540p&media_type=4&vr_type=0&improve_bitrate=0&h265=1&version_code=4.3.1&pass-region=1&pass-route=1&js_sdk_version=1.8.0.0&app_name=aweme&vid=82D42ABF-F373-4956-B714-8E7282B1C787&app_version=4.3.1&device_id=34961895962&channel=App%20Store&mcc_mnc=46002&aid=1128&screen_width=1125&openudid=e61cf44f1385470411f38d5fc1644968ef9d956c&os_api=18&ac=WIFI&os_version=12.2&device_platform=iphone&build_number=43104&device_type=iPhone10,3&iid=62539050602&idfa=D7F9AA02-AE58-4155-8EFB-8B6BBA58D00B&volume=0.44&min_cursor=0&longitude=116.1427412985355&feed_style=0&pull_type=1&count=6&user_id=93535612389&type=0&max_cursor=0&filter_warn=0&latitude=39.75063842799364&mas=013b8baec4b6ca5358488a912b02fccd502cf0bf33bd692f1988d7&as=a2b56adc86b6bce2821862&ts=1556259430'
